#ifndef STEPLED_H
#define STEPLED_H

#include<QObject>
#include<QTimer>
#include<QMap>
#include<QString>

enum LEDCOLOR {
    RED     = 0,
    GREEN   = 1,
};

enum LEDSTATES {
    ON       = 0,
    OFF      = 1,
    BLINK    = 2,
};

class Led: public QObject
{
    Q_OBJECT
public:
    QObject* obj = nullptr;
    QTimer* blinkTimer = nullptr;
    LEDCOLOR color = LEDCOLOR::GREEN;
    LEDSTATES status = LEDSTATES::ON;

    Led(QObject* obj,int interval=200):obj(obj), blinkTimer(new QTimer()),interval(interval){
        connect(blinkTimer, &QTimer::timeout, this, &Led::changeColor);
        blinkTimer->setInterval(interval);
    }

    void changeColor();
    void setColor(LEDCOLOR color);
    void setStatus(LEDSTATES state);
    void resetStatus();
    int interval;
};

#endif // STEPLED_H
